<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>VUE Template</title>
    <script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>
    <div id="root">
        姓：<input type="text" v-model="userInfo.firstName"><br>
        名：<input type="text" v-model="userInfo.lastName"><br>
        全名：<span>{{fullName}}</span>
    </div>
</body>
    <script type="text/javascript">
        
        const vm = new Vue({
            el:'#root',
            data:function(){
                return{
                    firstName:'张',
                    lastName:'三',
                    fullName:'张-三'
                }
            },
            computed:{
                //
            },
            methods:{
              
            },
            watch:{
                firstName(n,o){
                    setTimeout(() => {
                        this.fullName=n+this.lastName;
                    }, 1000);
                    
                },
                lastName(n,o){
                    this.fullName=this.firstName+n;
                }
            }
        })
    </script>
</html>